function getList(){
	$.ajax({
		"url":"/price_admin/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"type":"GET",
		"dataType":"jsonp",
		"success":function(data){
			if(responseCheck(data)){
				var tab=document.getElementById("tab")
				for (var site in data.content){
					var tr=document.createElement("tr")

					var td=document.createElement("td")
					td.textContent=site
					tr.appendChild(td)


					var td=document.createElement("td")
					td.textContent=data.content[site]["92"]
					tr.appendChild(td)
				
					var td=document.createElement("td")
					td.textContent=data.content[site]["95"]
					tr.appendChild(td)
				
					var td=document.createElement("td")
					td.textContent=data.content[site]["98"]
					tr.appendChild(td)
				
					var td=document.createElement("td")
					td.textContent=data.content[site]["0"]
					tr.appendChild(td)
				
					var td=document.createElement("td")
					td.textContent=data.content[site]["lng"]
					tr.appendChild(td)
				
					var td=document.createElement("td")
					td.textContent=data.content[site]["电"]
					tr.appendChild(td)
				
					tab.appendChild(tr)
				}
				//价格历史
				var tab=document.getElementById("tab2")
				for (var i=0;i<data.history.length;i++){
					var tr=document.createElement('tr')

					var td=document.createElement('td')
					td.textContent=data.history[i].site
					tr.appendChild(td)

					var td=document.createElement('td')
					td.textContent=data.history[i].oil.toUpperCase() +" #"
					tr.appendChild(td)

					var td=document.createElement('td')
					td.textContent=data.history[i].price
					tr.appendChild(td)

					var td=document.createElement('td')
					td.textContent=data.history[i].date
					tr.appendChild(td)

					tab.appendChild(tr)
				}
			}
		}
	})
}
function setPrice(data,name){
	if(!confirm("请您确认您即将修改 " + name +" 的价格为：\n" + "￥"+ data.price)){
		return false;
	}
	data=JSON.stringify(data)
	$.ajax({
		"url":"/price_admin/",
		"error":errorAjax,
		"beforeSend":start_load_pic,
		"complete":stop_load_pic,
		"data":{"data":data},
		"type":"POST",
		"success":function(data){
			if(responseCheck(data)){
				showSuccessNotice()
			}
		}
	})
}

getList()
